<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.'); 
class Modprop_cat_subcatHelper 
{
    function getItems()
    {
	global $mainframe, $option;   
	jimport('joomla.application.component.helper');
	$db = &JFactory::getDBO();

        $query = 'SELECT c.*, '
				. ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as slug'
                . ' FROM #__properties_category as c '
				. ' WHERE c.published = 1 '
				. ' AND c.parent = 0 '
				. ' ORDER BY c.ordering'
				;										
        $db->setQuery($query);
		//$items = $db->loadObjectList();		
        $items = ($items = $db->loadObjectList())?$items:array(); 
        return $items;
    }
	
	
function getSubItems()
	{
		global $mainframe, $option;   
	jimport('joomla.application.component.helper');
	$db = &JFactory::getDBO();

        $query = 'SELECT c.*, '
				. ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as slug'
                . ' FROM #__properties_category as c '
				. ' WHERE c.published = 1 '
				. ' AND c.parent <> 0 '
				. ' ORDER BY c.ordering'
				;										
        $db->setQuery($query);
		//$items = $db->loadObjectList();		
        $sitems = ($sitems = $db->loadObjectList())?$sitems:array(); 
        return $sitems;
    }


} 


	